// pages/my/my.js
Page({

  data: {
    getUserInfo: true,
    userInfo: {}
  },
  bindGetUserInfo:function(e){
    console.log(e)
    this.onLoad()
  },
  onLoad: function (options) {
    let that = this
    wx.getUserInfo({
      success: function(res) {
        // console.log(res)
        that.setData({
          userInfo: res.userInfo
        })
      },
      fail(){
        
      }
    })

    wx.getSetting({
     success:function(res){
      //  console.log(res)
      // console.log(res.authSetting['scope.userInfo'])
      if(res.authSetting['scope.userInfo']){
        let us=res.authSetting['scope.userInfo']
        wx.getUserInfo({
          success:function(res){
            console.log(res.userInfo)
            that.setData({
              getUserInfo:!us
            })
            // console.log(that.data.getUserInfo)
          },
        })
      }
     }
    })

  },

})